Skip to content

Update all dependencies#218

Merged
lemonmade merged 7 commits intomasterfrom
update-deps
Oct 13, 2016
Merged

Update all dependencies#218
lemonmade merged 7 commits intomasterfrom
update-deps

Conversation

@lemonmade
Copy link
Member

This PR updates all of our linting dependencies to their most recent versions and adds the new rules they introduced. Most notably, the following rules now apply:

  • Line comments should be above the line they are commenting, not at the end of it (definitely open to discussion, wasn't sure about this one).
  • Always include a description when using the Symbol function.
  • A bunch of spacing-related rules for Flow.
  • In Flow, prevent the usage of Function as a type (I chose not to restrict Object and any since I find them to be useful occasionally, not sure about it though).
  • Prevent the usage of done and returning a promise together in mocha tests.
  • Require whitespace around directives, like 'expose Foo'.

cc/ @Shopify/javascript @bouk thoughts?

@arapehl
Copy link

arapehl commented Sep 14, 2016

The line comment one is a bit tricky 'cause sometimes you don't want to break up a clean block of assignments but want a small comment next to one item.

Otherwise, these all seem reasonable to me.

README.md Outdated

- [12.13](#12.13) <a name="12.13"></a> Instance methods that don’t refer to `this` don’t need to be instance methods. If they relate to the class, make them static methods; otherwise, make them functions in scope.

> Why? This pattern is generally a sign that you are providing a bad public API for the class, and should either hide this method (if it’s an implementation detail) or expose it as a utility method.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe call it 'export' instead of 'expose'

@lemonmade
Copy link
Member Author

reping @Shopify/javascript. I think I am still leaning towards keeping the recommendation for line comments to appear above the line they are documenting, since I think that's usually the better choice and it's worth the consistency. Added a few more updates since I initially did this PR, so a few more things that might need discussion:

  • When using Node modules, prefer module.exports.foo over exports.foo (not sure about this one)
  • Only one top-level suite per file for Mocha tests
  • In React components, no explicit children prop (i.e., prefer <Foo>{bar}</Foo> over <Foo children={bar} />
  • @flow comments should be done as line comments

@bouk
Copy link
Contributor

bouk commented Oct 12, 2016

I don't think preferring module.exports or export matters because we recommend using ES6 module syntax

I don't think we should have a preference of what flow comment style to use

@mikkoh
Copy link
Member

mikkoh commented Oct 13, 2016

I think it's still worth having the rule for module.exports.foo. As @bouk said it's an edge case now but in my experience exports.foo may cause issues with tooling. Just safer to use module.exports.foo.

@lemonmade
Copy link
Member Author

Keeping the module.exports rule, removed the preference on the flow comment, and removed no-sync (which was disabled in pretty much all node projects I've seen).

@bouk
Copy link
Contributor

bouk commented Oct 13, 2016

lgtm

@lemonmade lemonmade merged commit 45fde11 into master Oct 13, 2016
@lemonmade lemonmade deleted the update-deps branch October 13, 2016 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants